package com.jxpanda.infrastructure.crypto.key;

import com.jxpanda.infrastructure.crypto.constant.AlgorithmSign;
import com.jxpanda.infrastructure.crypto.key.contract.AbstractKeyProvider;
import com.jxpanda.infrastructure.crypto.key.contract.KeyPairProvider;
import org.bouncycastle.jcajce.spec.EdDSAParameterSpec;

import java.security.KeyPair;

public class EdKeyPairProvider extends AbstractKeyProvider<KeyPair, EdDSAParameterSpec> implements KeyPairProvider<EdDSAParameterSpec> {

    public EdKeyPairProvider(AlgorithmSign.EdDSA edDSA) {
        super(edDSA.getAlgorithm());
    }

    @Override
    public KeyPair generateKey() {
        return generateKey(createAlgorithmParameterSpec(this.getAlgorithm()));
    }

    public static EdDSAParameterSpec createAlgorithmParameterSpec(String algorithm) {
        return new EdDSAParameterSpec(algorithm);
    }


}
